#pragma once

#include <QtWidgets/QMainWindow>
#include "ui_snake.h"
#include <qpainter.h>
#include <QVector>
#include <qstring.h>
class QSound;
namespace Ui {
    class Snake;
}
class Snake : public QMainWindow
{
    Q_OBJECT

public:
    Snake(QWidget *parent = Q_NULLPTR);
    void paintEvent(QPaintEvent* event);
    void InitSnake();
    QRect CreateRect();
    void IsEat();
    void IsHit();
private slots:
    void Snake_update();
private:
    Ui::snakeClass ui;
    QVector<QRect> vSnakeRect;
    QRect SnakeHead;
    void keyPressEvent(QKeyEvent* key);
    QTimer* timer;
    bool blsRun;
    bool blsOver;
    QString sDisplay;
    int nDirection;
    QRect food;
    int nScore;
    QString scoreLabel;
    int speed;
    QSound* startsound = NULL;
    bool playMusic = false;
};
#endif // SNAKE_H